package com.zhoug.chart3.markers;

import com.github.mikephil.charting.data.Entry;
import com.zhoug.chart3.core.MPConstant;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: zhoug
 * @Date: 2024-02-05
 * @Description:
 */
public class MPMarkerData {
    private String xLabel;//X轴标签
    private List<YData> data;
    private int dataSetIndex = -1;
    private int entryIndex = -1;
    private int stackIndex = -1;


    public MPMarkerData(String xLabel) {
        this.xLabel = xLabel;
        this.data = new ArrayList<>();
    }

    public String getXLabel() {
        return xLabel;
    }

    public List<YData> getData() {
        return data;
    }

    public void setData(List<YData> data) {
        this.data = data;
    }

    public void addData(List<YData> data) {
        if (data != null && data.size() > 0) {
            this.data.addAll(data);
        }
    }

    public int getDataSetIndex() {
        return dataSetIndex;
    }

    public void setDataSetIndex(int dataSetIndex) {
        this.dataSetIndex = dataSetIndex;
    }

    public int getEntryIndex() {
        return entryIndex;
    }

    public void setEntryIndex(int entryIndex) {
        this.entryIndex = entryIndex;
    }

    public int getStackIndex() {
        return stackIndex;
    }

    public void setStackIndex(int stackIndex) {
        this.stackIndex = stackIndex;
    }

    public void addData(YData yData) {
        data.add(yData);
    }


    public static class YData {
        private String label;//y轴标签
        private float value;//y轴的值
        private String formatValue;//y轴的值格式化输入出
        private int color;//y颜色
        private float selfRatio;//在同一个Entry中的占比
        private float selfSum;//在同一个Entry中的总数
        private float groupSum;//在同一个group中的同一类的总和
        private float groupRatio;//在同一个group中的同一类的占比
        private @MPConstant.ChartType
        int chartType;
        private Entry entry;
        private int dataSetIndex;
        private int stackIndex=-1;
        private int entryIndex=-1;

        public String getLabel() {
            return label;
        }

        public void setLabel(String label) {
            this.label = label;
        }

        public float getValue() {
            return value;
        }

        public void setValue(float value) {
            this.value = value;
        }
        public String getFormatValue() {
            return formatValue;
        }

        public void setFormatValue(String formatValue) {
            this.formatValue = formatValue;
        }
        public int getColor() {
            return color;
        }

        public void setColor(int color) {
            this.color = color;
        }

        public float getSelfSum() {
            return selfSum;
        }

        public void setSelfSum(float selfSum) {
            this.selfSum = selfSum;
        }

        public float getSelfRatio() {
            return selfRatio;
        }

        public void setSelfRatio(float selfRatio) {
            this.selfRatio = selfRatio;
        }

        public float getGroupRatio() {
            return groupRatio;
        }

        public void setGroupRatio(float groupRatio) {
            this.groupRatio = groupRatio;
        }

        public int getChartType() {
            return chartType;
        }

        public void setChartType(int chartType) {
            this.chartType = chartType;
        }

        public Entry getEntry() {
            return entry;
        }

        public void setEntry(Entry entry) {
            this.entry = entry;
        }

        public int getDataSetIndex() {
            return dataSetIndex;
        }

        public void setDataSetIndex(int dataSetIndex) {
            this.dataSetIndex = dataSetIndex;
        }

        public int getStackIndex() {
            return stackIndex;
        }

        public void setStackIndex(int stackIndex) {
            this.stackIndex = stackIndex;
        }

        public float getGroupSum() {
            return groupSum;
        }

        public void setGroupSum(float groupSum) {
            this.groupSum = groupSum;
        }


        public int getEntryIndex() {
            return entryIndex;
        }

        public void setEntryIndex(int entryIndex) {
            this.entryIndex = entryIndex;
        }

        @Override
        public String toString() {
            return "YData{" +
                    "label='" + label + '\'' +
                    ", value=" + value +
                    ", formatValue=" + formatValue +
                    ", color=" + color +
                    ", selfSum=" + selfSum +
                    ", groupSum=" + groupSum +
                    ", selfRatio=" + selfRatio +
                    ", groupRatio=" + groupRatio +
                    ", chartType=" + chartType +
                    ", dataSetIndex=" + dataSetIndex +
                    ", stackIndex=" + stackIndex +
                    '}';
        }
    }

}
